package types

import (
	"errors"
	"fmt"
)

var (
	ErrRegisterForbidden          = errors.New("ErrRegisterForbidden")
	ErrPublisherNotReady          = errors.New("ErrPublisherNotReady")
	ErrTryConnectLater            = errors.New("ErrTryConnectLater")
	ErrPublishShouldRegisterFirst = errors.New("ErrPublishShouldRegisterFirst")
)

func ErrParseSubscriptionFaild(err error) Error {
	return Error{
		Err:  err,
		Code: 1000,
	}
}

func ErrUnsupportMessageType(mt int) Error {
	return Error{
		Err:  fmt.Errorf("ErrUnsupportMessageType %d", mt),
		Code: 1001,
	}
}

func ErrUnsupportAction(action string) Error {
	return Error{
		Err:  fmt.Errorf("ErrUnsupportAction %s", action),
		Code: 1002,
	}
}

func ErrBadRequest(err error) Error {
	return Error{
		Err:  err,
		Code: 2000,
	}
}

func ErrPublishFailed(err error) Error {
	return Error{
		Err:  err,
		Code: 3000,
	}
}

func ErrPublishForbidden(err error) Error {
	return Error{
		Err:  err,
		Code: 3001,
	}
}
